

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/blog/img/fluid.png">
  <link rel="icon" href="/blog/img/avatar2.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Zhou Jie">
  <meta name="keywords" content="">
  
    <meta name="description" content="Nifi1.nifi是什么？ 为了解决不同系统之间数据自动流通的问题的工具 2.使用场景？ 高效且可被追踪的 将数据 从A搬到B，B搬到C，C搬到A等等 01视频是为了测试消息消费者是否能转发给下一个消息发布者，当我手动在 消息消费者 那儿发布一则消息，那么 消息消费者 自动转发给了 下一个消息发布这那儿，那我在消息发布者那儿订阅消息，如果能获取到，那就说明 进行了转发操作 那为什么 地点在同一个">
<meta property="og:type" content="article">
<meta property="og:title" content="Kafka和Nifi的使用">
<meta property="og:url" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/index.html">
<meta property="og:site_name" content="Zhou Jie">
<meta property="og:description" content="Nifi1.nifi是什么？ 为了解决不同系统之间数据自动流通的问题的工具 2.使用场景？ 高效且可被追踪的 将数据 从A搬到B，B搬到C，C搬到A等等 01视频是为了测试消息消费者是否能转发给下一个消息发布者，当我手动在 消息消费者 那儿发布一则消息，那么 消息消费者 自动转发给了 下一个消息发布这那儿，那我在消息发布者那儿订阅消息，如果能获取到，那就说明 进行了转发操作 那为什么 地点在同一个">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE1.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE2.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE3.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE4.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE5.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE6.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE7.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE8.png">
<meta property="og:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE9.png">
<meta property="article:published_time" content="2023-08-31T05:51:20.000Z">
<meta property="article:modified_time" content="2024-04-01T03:41:22.052Z">
<meta property="article:author" content="Zhou Jie">
<meta property="article:tag" content="kafka、nifi">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE1.png">
  
  
  
  <title>Kafka和Nifi的使用 - Zhou Jie</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/blog/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/blog/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/blog/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"jay213.gitee.io","root":"/blog/","version":"1.9.4","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/blog/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/blog/js/utils.js" ></script>
  <script  src="/blog/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 5.4.2"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/blog/">
      <strong>Indispensible</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/blog/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Kafka和Nifi的使用"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-08-31 13:51" pubdate>
          2023年8月31日 下午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          1.1k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          10 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Kafka和Nifi的使用</h1>
            
            
              <div class="markdown-body">
                
                <h3 id="Nifi"><a href="#Nifi" class="headerlink" title="Nifi"></a>Nifi</h3><p><strong>1.nifi是什么？</strong></p>
<p>为了解决不同系统之间数据自动流通的问题的工具</p>
<p><strong>2.使用场景？</strong></p>
<p>高效且可被追踪的 将数据 从A搬到B，B搬到C，C搬到A等等</p>
<p>01视频是为了测试消息消费者是否能转发给下一个消息发布者，当我手动在 消息消费者 那儿发布一则消息，那么 消息消费者 自动转发给了 下一个消息发布这那儿，那我在消息发布者那儿订阅消息，如果能获取到，那就说明 进行了转发操作</p>
<p>那为什么 地点在同一个位置也可以收到呢？</p>
<p>因为 同一个地点发布同一个地点订阅当然能收到，在此之前没有 经过转发操作</p>
<p><strong>3</strong>.<strong>Nifi的一些常见术语</strong></p>
<p>Flow File：系统中移动的每个对象，包含 属性和内容 两个变量</p>
<p>Prosess File：对Flow File中的数据进行处理</p>
<h3 id="Kafka"><a href="#Kafka" class="headerlink" title="Kafka"></a>Kafka</h3><p>它被设计用于高吞吐量、低延迟和可持久性的数据流处理。Kafka主要用于解决应用程序之间的异步通信、数据传输和事件流处理等后端场景。</p>
<p>将Kafka作为后端技术的例子包括：</p>
<ol>
<li>数据流处理：Kafka常用于在大规模数据流中传递、存储和处理数据，例如实时日志采集、事件处理、数据管道等。</li>
<li>消息队列：Kafka作为一种高性能的消息队列，可以作为后端的消息中间件，用于解耦和缓冲生产者和消费者之间的通信，支持发布-订阅模式。</li>
</ol>
<h3 id="MQTT"><a href="#MQTT" class="headerlink" title="MQTT"></a>MQTT</h3><p>和kafka类似的消息传递系统。</p>
<h4 id="下面是一个消息的传递实例：MQTT-gt-nifi-gt-kafka-gt-nifi-gt-MQTT"><a href="#下面是一个消息的传递实例：MQTT-gt-nifi-gt-kafka-gt-nifi-gt-MQTT" class="headerlink" title="下面是一个消息的传递实例：MQTT-&gt;nifi-&gt;kafka-&gt;nifi-&gt;MQTT"></a>下面是一个消息的传递实例：MQTT-&gt;nifi-&gt;kafka-&gt;nifi-&gt;MQTT</h4><h6 id="步骤："><a href="#步骤：" class="headerlink" title="步骤："></a>步骤：</h6><p>1）创建按一个consumer并配置（和练习的一样）</p>
<p>2）创建一个Extract Text（拖下来后在里面搜），用于对资料的截取，并配置如下</p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE1.png" srcset="/blog/img/loading.gif" lazyload alt="配置"></p>
<p>3）将前两个processor连接起来，1）-&gt; 2），这样在consumer那儿 pub资料后，资料会流到2）来进行截取资料</p>
<p>4）新建一个 ReplaceText（在里面搜），并进行如下配置，目的是 在传递给kafka之前要有一个数据的标准形式，这里的Replace可以看成是 格式的 replace</p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE2.png" srcset="/blog/img/loading.gif" lazyload alt="配置2"></p>
<p>5）新建一个kafka的processor（.10.1版本），先配置，因为是最后一个processor，因此后面相关的都terminal </p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE3.png" srcset="/blog/img/loading.gif" lazyload alt="配置3"></p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE4.png" srcset="/blog/img/loading.gif" lazyload alt="配置4"></p>
<p>再将箭头 从replace拉到 kafka处，配置connection的relationship为success，表示 只有成功匹配并处理才会抛给kafka</p>
<p>再配置replace</p>
<p>然后可以测试了，测试内容在01视频最后</p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE5.png" srcset="/blog/img/loading.gif" lazyload alt="配置5"></p>
<p>6）新建一个工作区<img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE6.png" srcset="/blog/img/loading.gif" lazyload alt="配置6"></p>
<p>7）新建一个consumerkafka，配置如下：</p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE7.png" srcset="/blog/img/loading.gif" lazyload alt="配置7"></p>
<p>8）添加一个MQTTPublish，将连接 从Kkafka连向这个，然后connect配置还是success。它的配置如下：</p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE8.png" srcset="/blog/img/loading.gif" lazyload alt="配置8"></p>
<p><img src="/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/%E9%85%8D%E7%BD%AE9.png" srcset="/blog/img/loading.gif" lazyload alt="配置9"></p>
<p>然后在最后这订阅进行测试</p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/blog/categories/%E5%90%8E%E7%AB%AF%E6%8A%80%E6%9C%AF/" class="category-chain-item">后端技术</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/blog/tags/kafka%E3%80%81nifi/">#kafka、nifi</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Kafka和Nifi的使用</div>
      <div>https://jay213.gitee.io/blog/2023/08/31/kafka和nifi的使用/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Zhou Jie</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年8月31日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/blog/2023/09/04/vue2%E5%92%8Cvue3%E5%93%8D%E5%BA%94%E5%BC%8F%E6%95%B0%E6%8D%AE%E7%9A%84%E5%A4%84%E7%90%86%E7%9A%84%E4%B8%8D%E5%90%8C/" title="Vue2和Vue3响应式数据的处理的不同">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Vue2和Vue3响应式数据的处理的不同</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/blog/2023/08/31/k8s%E3%80%81docker%E3%80%81rancher%E7%9A%84%E5%85%B3%E7%B3%BB/" title="k8s、harbor、docker、rancher的关系？">
                        <span class="hidden-mobile">k8s、harbor、docker、rancher的关系？</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments" lazyload>
      
  <div class="disqus" style="width:100%">
    <div id="disqus_thread"></div>
    
      <script type="text/javascript">
        var disqus_config = function() {
          this.page.url = 'https://jay213.gitee.io/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/';
          this.page.identifier = '/blog/2023/08/31/kafka%E5%92%8Cnifi%E7%9A%84%E4%BD%BF%E7%94%A8/';
        };
        Fluid.utils.loadComments('#disqus_thread', function() {
          var d = document, s = d.createElement('script');
          s.src = '//' + 'fluid' + '.disqus.com/embed.js';
          s.setAttribute('data-timestamp', new Date());
          (d.head || d.body).appendChild(s);
        });
      </script>
    
    <noscript>Please enable JavaScript to view the comments</noscript>
  </div>


    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/blog/js/events.js" ></script>
<script  src="/blog/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/blog/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/blog/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/blog/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
